home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / datamgr / field.frm < prev    next >
Text File  |  1995-10-23  |  6KB  |  224 lines

  1. VERSION 2.00
  2. Begin Form FieldForm 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Field Form"
  6.    ClientHeight    =   2235
  7.    ClientLeft      =   315
  8.    ClientTop       =   915
  9.    ClientWidth     =   4605
  10.    Height          =   2640
  11.    Left            =   255
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   2235
  16.    ScaleWidth      =   4605
  17.    Top             =   570
  18.    Width           =   4725
  19.    Begin CheckBox cCounter 
  20.       BackColor       =   &H00C0C0C0&
  21.       Caption         =   "&Counter"
  22.       Height          =   255
  23.       Left            =   1440
  24.       TabIndex        =   12
  25.       Top             =   1320
  26.       Visible         =   0   'False
  27.       Width           =   1335
  28.    End
  29.    Begin CommandButton Command2 
  30.       Cancel          =   -1  'True
  31.       Caption         =   "&Cancel"
  32.       Height          =   375
  33.       Left            =   3120
  34.       TabIndex        =   7
  35.       Top             =   1680
  36.       Width           =   1215
  37.    End
  38.    Begin CommandButton Command1 
  39.       Caption         =   "&OK"
  40.       Default         =   -1  'True
  41.       Height          =   375
  42.       Left            =   1800
  43.       TabIndex        =   6
  44.       Top             =   1680
  45.       Width           =   1215
  46.    End
  47.    Begin TextBox Text2 
  48.       Height          =   300
  49.       Left            =   1440
  50.       TabIndex        =   5
  51.       Top             =   960
  52.       Width           =   2895
  53.    End
  54.    Begin ComboBox Combo1 
  55.       Height          =   300
  56.       Left            =   1440
  57.       Style           =   2  'Dropdown List
  58.       TabIndex        =   3
  59.       Top             =   600
  60.       Width           =   2895
  61.    End
  62.    Begin TextBox Text1 
  63.       Height          =   300
  64.       Left            =   1440
  65.       TabIndex        =   1
  66.       Top             =   240
  67.       Width           =   2895
  68.    End
  69.    Begin Label FSize 
  70.       Caption         =   "Label6"
  71.       Height          =   255
  72.       Left            =   840
  73.       TabIndex        =   11
  74.       Top             =   1680
  75.       Visible         =   0   'False
  76.       Width           =   255
  77.    End
  78.    Begin Label fType 
  79.       Caption         =   "Label5"
  80.       Height          =   255
  81.       Left            =   480
  82.       TabIndex        =   10
  83.       Top             =   1680
  84.       Visible         =   0   'False
  85.       Width           =   255
  86.    End
  87.    Begin Label FName 
  88.       Caption         =   "Label4"
  89.       Height          =   255
  90.       Left            =   120
  91.       TabIndex        =   9
  92.       Top             =   1680
  93.       Visible         =   0   'False
  94.       Width           =   255
  95.    End
  96.    Begin Label ExitCondition 
  97.       Height          =   255
  98.       Left            =   120
  99.       TabIndex        =   8
  100.       Top             =   1320
  101.       Visible         =   0   'False
  102.       Width           =   255
  103.    End
  104.    Begin Label Label3 
  105.       Alignment       =   1  'Right Justify
  106.       BackStyle       =   0  'Transparent
  107.       Caption         =   "Field &Size:"
  108.       Height          =   375
  109.       Left            =   240
  110.       TabIndex        =   4
  111.       Top             =   960
  112.       Width           =   1095
  113.    End
  114.    Begin Label Label2 
  115.       Alignment       =   1  'Right Justify
  116.       BackStyle       =   0  'Transparent
  117.       Caption         =   "Field &Type:"
  118.       Height          =   255
  119.       Left            =   240
  120.       TabIndex        =   2
  121.       Top             =   600
  122.       Width           =   1095
  123.    End
  124.    Begin Label Label1 
  125.       Alignment       =   1  'Right Justify
  126.       BackStyle       =   0  'Transparent
  127.       Caption         =   "Field &Name:"
  128.       Height          =   255
  129.       Left            =   240
  130.       TabIndex        =   0
  131.       Top             =   240
  132.       Width           =   1095
  133.    End
  134. End
  135. Option Explicit
  136.  
  137. Sub Combo1_Click ()
  138.     If combo1.ItemData(combo1.ListIndex) = 4 Then 'Long Int
  139.         cCounter.Visible = True
  140.     Else
  141.         cCounter.Visible = False
  142.     End If
  143.     Select Case combo1.ItemData(combo1.ListIndex)
  144.         Case 10
  145.             label3.ForeColor = 0
  146.             text2.Enabled = True
  147.         Case Else
  148.             label3.ForeColor = QBColor(8)
  149.             text2.Text = ""
  150.             text2.Enabled = False
  151.     End Select
  152.  
  153. End Sub
  154.  
  155. Sub Command1_Click ()
  156.     Dim flag As Integer
  157.  
  158.     flag = True
  159.  
  160.     If text1 = "" Then
  161.         MsgBox "Invalid Field Name", 64, "Data Manager"
  162.         flag = False
  163.         text1.SetFocus
  164.  
  165.     ElseIf combo1.ListIndex = -1 Then
  166.         MsgBox "You must select a valid field type", 64, "Data Manager"
  167.         flag = False
  168.         combo1.SetFocus
  169.  
  170.     ElseIf combo1.ItemData(combo1.ListIndex) = 10 Then
  171.         If Val(text2) < 1 Or Val(text2) > 255 Then
  172.             MsgBox "Field Size (for Text Fields) must be between 1 and 255", 64, "Data Manager"
  173.             text2.SetFocus
  174.             flag = False
  175.         End If
  176.     End If
  177.  
  178.     If flag Then
  179.         Me.ExitCondition = "OK"
  180.         Me.Hide
  181.         Me.FName = text1
  182.         Me.fType = combo1.ItemData(combo1.ListIndex)
  183.         If Me.fType = 10 Then
  184.             Me.FSize = text2
  185.         Else
  186.             Me.FSize = 0
  187.         End If
  188.     End If
  189.  
  190. End Sub
  191.  
  192. Sub Command2_Click ()
  193.     Me.ExitCondition = "Cancel"
  194.     Me.Hide
  195. End Sub
  196.  
  197. Sub Form_Load ()
  198.     combo1.AddItem "Boolean"
  199.     combo1.AddItem "Byte"
  200.     combo1.AddItem "Integer"
  201.     combo1.AddItem "Long Integer"
  202.     combo1.AddItem "Currency"
  203.     combo1.AddItem "Single"
  204.     combo1.AddItem "Double"
  205.     combo1.AddItem "Date/Time"
  206.     combo1.AddItem "Text"
  207.     combo1.AddItem "Binary"
  208.     combo1.AddItem "Memo"
  209.  
  210.     combo1.ItemData(0) = 1
  211.     combo1.ItemData(1) = 2
  212.     combo1.ItemData(2) = 3
  213.     combo1.ItemData(3) = 4
  214.     combo1.ItemData(4) = 5
  215.     combo1.ItemData(5) = 6
  216.     combo1.ItemData(6) = 7
  217.     combo1.ItemData(7) = 8
  218.     combo1.ItemData(8) = 10
  219.     combo1.ItemData(9) = 11
  220.     combo1.ItemData(10) = 12
  221.  
  222. End Sub
  223.  
  224.